#include <iostream>
using namespace std;

#include "CSSException.h"
#include "ConditionImpl.h"

#include "SelectorImpl.h"
#include "DocumentHandlerImpl.h"

#include "Tokenizer.h"
extern int yyparse();
extern int yydebug;

ConditionFactory* g_ConditionFactory;
SelectorFactory* g_SelectorFactory;
DocumentHandler* g_DocumentHandler;


void TestCSSException()
{
	try
	{
		throw CSSException(CSSException::SAC_NOT_SUPPORTED_ERR);
	}
	catch(CSSException& e)
	{
		cout << *e.getMessage() << endl;
	}
}

void TestAttributeCondition()
{
	Condition* iResult = new AttributeConditionImpl();
	cout << iResult->getConditionType()<< endl;
}

int main()
{



	yyin = fopen("/home/Xairy/Browser/xairycssparser/bin/Debug/test.txt", "r");
	if(!yyin)
	{
		perror("open file error");
		return -1;
	}
	//yydebug = 1;
	g_ConditionFactory = new ConditionFactoryImpl;
	g_SelectorFactory = new SelectorFactoryImpl;
	g_DocumentHandler = new DocumentHandlerImpl;
	cout << "parser result " << yyparse() << endl;

	getchar();
	delete g_ConditionFactory;
	delete g_SelectorFactory;
	return 1;
}
